package com.edfu.core.testmgt.service.api;

import java.util.List;
import java.util.Set;

import org.springframework.security.access.prepost.PreAuthorize;

import com.edfu.core.testmgt.vo.FormatType;
import com.edfu.core.testmgt.vo.Option;
import com.edfu.core.testmgt.vo.Question;
import com.edfu.core.testmgt.vo.QuestionType;
import com.edfu.core.testmgt.vo.Test;
import com.edfu.core.testmgt.vo.TestBundle;
import com.edfu.core.testmgt.vo.TestType;
import com.edfu.core.testmgt.vo.UserTest;

public interface ITestMgtService {
	
	@PreAuthorize("isAnonymous()")
	public Test createTest(long testBundleId, Test test);
	
	@PreAuthorize("isAnonymous()")
	public Test updateTest(Test test);
	
	@PreAuthorize("isAnonymous()")
	public void removeTest(long testId);
	
	@PreAuthorize("isAnonymous()")
	public Test getTest(long testId);
	
	@PreAuthorize("isAnonymous()")
	public Test getTest(String testCode);
	
	@PreAuthorize("isAnonymous()")
	public TestBundle createTestBundle(TestBundle testBundle);
	
	@PreAuthorize("isAnonymous()")
	public TestBundle updateTestBundle(TestBundle testBundle);
	
	@PreAuthorize("isAnonymous()")
	public void removeTestBundle(long testBundleId);
	
	@PreAuthorize("isAnonymous()")
	public void removeTestBundle(String testBundleCode);
	
	@PreAuthorize("isAnonymous()")
	public TestBundle getTestBundle(long testBundleId);
	
	@PreAuthorize("isAnonymous()")
	public TestBundle getTestBundle(String testBundleCode);
	
	@PreAuthorize("isAnonymous()")
	public List<Test> getTests(long testBundleId);
	
	@PreAuthorize("isAnonymous()")
	public List<Test> getTests(String testBundleCode);
	
	@PreAuthorize("isAnonymous()")
	public List<Test> getTestDetails();
	
	@PreAuthorize("hasRole('TEST_PERMISSION')")
	public TestType createTestType(String testTypeName, String testTypeDesc);
	
	@PreAuthorize("isAnonymous()")
	public TestType updateTestType(TestType testType);
	
	@PreAuthorize("isAnonymous()")
	public void removeTestType(long testTypeId);
	
	@PreAuthorize("isAnonymous()")
	public void removeTestType(String testTypeName);
	
	@PreAuthorize("isAnonymous()")
	public List<TestType> getTestTypes();
	
	@PreAuthorize("isAnonymous()")
	public TestType getTestType(long testTypeId);
	
	@PreAuthorize("isAnonymous()")
	public TestType getTestType(String testTypeName);
	
	@PreAuthorize("isAnonymous()")
	public Question addQuestion(long testId, Question question);
	
	@PreAuthorize("isAnonymous()")
	public Set<Question> addQuestions(long testId, Set<Question> questions);
	
	@PreAuthorize("isAnonymous()")
	public Question updateQuestion(Question question);
	
	@PreAuthorize("isAnonymous()")
	public void removeQuestion(long questionId);
	
	@PreAuthorize("isAnonymous()")
	public Set<Question> getQuestions(long testId);
	
	@PreAuthorize("isAnonymous()")
	public Set<Question> getQuestionsWithAnswers(long testId);
	
	@PreAuthorize("isAnonymous()")
	public Set<Option> getAnswers(long questionId);
	
	@PreAuthorize("hasRole('TEST_PERMISSION')")
	public QuestionType createQuestionType(String questionTypeName, String questionTypeDesc);
	
	@PreAuthorize("isAnonymous()")
	public QuestionType updateQuestionType(QuestionType questionType);
	
	@PreAuthorize("isAnonymous()")
	public void removeQuestionType(long questionTypeId);
	
	@PreAuthorize("isAnonymous()")
	public void removeQuestionType(String questionTypeName);
	
	@PreAuthorize("isAnonymous()")
	public List<QuestionType> getQuestionTypes();
	
	@PreAuthorize("isAnonymous()")
	public QuestionType getQuestionType(long questionTypeId);
	
	@PreAuthorize("isAnonymous()")
	public QuestionType getQuestionType(String questionTypeName);
	
	@PreAuthorize("hasRole('TEST_PERMISSION')")
	public FormatType createFormatType(String formatTypeName);
	
	@PreAuthorize("isAnonymous()")
	public FormatType updateFormatType(FormatType formatType);
	
	@PreAuthorize("isAnonymous()")
	public void removeFormatType(long formatTypeId);
	
	@PreAuthorize("isAnonymous()")
	public void removeFormatType(String formatTypeName);
	
	@PreAuthorize("isAnonymous()")
	public List<FormatType> getFormatTypes();
	
	@PreAuthorize("isAnonymous()")
	public FormatType getFormatType(long formatTypeId);
	
	@PreAuthorize("isAnonymous()")
	public FormatType getFormatType(String formatTypeName);
	
	@PreAuthorize("isAnonymous()")
	public void subscribeTest(UserTest userTest);
	
	@PreAuthorize("isAnonymous()")
	public void unsubscribeTest(UserTest userTest);
	
	@PreAuthorize("isAnonymous()")
	public List<Test> getSubscribedTests(String userId);
	
	@PreAuthorize("isAnonymous()")
	public void addOrUpdateUserTestDetails(UserTest userTest);
	
	@PreAuthorize("isAnonymous()")
	public UserTest getUserTestDetails(UserTest userTest);
	
	@PreAuthorize("isAnonymous()")
	public UserTest getUserTestDetailsWithAnswers(UserTest userTest);
	
	@PreAuthorize("isAnonymous()")
	public void submitUserTestAnswers(UserTest userTest);
	
	@PreAuthorize("isAnonymous()")
	public void uploadTestBundle();
	
	@PreAuthorize("isAnonymous()")
	public UserTest processUserTestResults(UserTest userTest);

    @PreAuthorize("isAnonymous()")
    public void associateTestToCategory(String categoryName, String testCode);
    
    @PreAuthorize("isAnonymous()")
    public List<Test> getAssociatedTests(String categoryName); 
   
    
}
